package com.wuxiaofan.product.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.product.entity.ProductAttrValue;
import com.wuxiaofan.product.entity.custom.ProductAttrValueCustom;
import com.wuxiaofan.product.mapper.ProductAttrValueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.product.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class ProductAttrValueService {
    @Autowired
    private ProductAttrValueMapper pmsProductAttrValueMapper;
    @Resource
    private Idgenerator idgenerator;
    public ProductAttrValue findById(String id){
        return pmsProductAttrValueMapper.selectById(id);
    }

    public ProductAttrValueCustom findCountByMap(Map paraMap){
        return pmsProductAttrValueMapper.findCountByMap(paraMap);
    }

    public ProductAttrValueCustom findGroupByMap(Map paraMap){
        return pmsProductAttrValueMapper.findGroupByMap(paraMap);
    }

    public List<ProductAttrValueCustom> findByMap(Map paraMap){
        return pmsProductAttrValueMapper.findByMap(paraMap);
    }

    public Page<ProductAttrValueCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(pmsProductAttrValueMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        pmsProductAttrValueMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        pmsProductAttrValueMapper.deleteById(id);
    }

    public ProductAttrValue save(ProductAttrValue pmsProductAttrValue){
        pmsProductAttrValue.setId(idgenerator.getId());
        pmsProductAttrValueMapper.insert(pmsProductAttrValue);
        return pmsProductAttrValue;
    }

}
